#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 310;

int f[N][N];
int n, a[N], b[N], x, y;

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	memset(f, 0x3f, sizeof f); n = in; x = in, y = in;
	rep(i, 1, n) a[i] = in, b[i] = in;
	f[0][0] = 0;
	rep(i, 1, n) {
		per(j, x, 0)
			per(t, y, 0)
			if(f[j][t] < 1e9) {
				f[min(j + a[i], x)][min(t + b[i], y)] = min(f[min(j + a[i], x)][min(t + b[i], y)], f[j][t] + 1);
			}
	}
	cout << (f[x][y] < 1e9 ? f[x][y] : -1) << endl;
}
